<?php
/* SVN FILE: $Id: bootstrap.php 7945 2008-12-19 02:16:01Z gwoo $ */
/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
 * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright     Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
 * @link          http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.app.config
 * @since         CakePHP(tm) v 0.10.8.2117
 * @version       $Revision: 7945 $
 * @modifiedby    $LastChangedBy: gwoo $
 * @lastmodified  $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */
/**
 *
 * This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded
 * This is an application wide file to load any function that is not used within a class define.
 * You can also use this to include or require any files in your application.
 *
 */
/**
 * The settings below can be used to set additional paths to models, views and controllers.
 * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
 *
 * $modelPaths = array('full path to models', 'second full path to models', 'etc...');
 * $viewPaths = array('this path to views', 'second full path to views', 'etc...');
 * $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
 *
 */

$boom = explode('.', $_SERVER["HTTP_HOST"]);
$parts = count($boom);
$site_root = $boom[$parts-2].'.'.$boom[$parts-1];
define('SITE_ROOT', $site_root);

if ( isset($_SERVER['SERVER_NAME']) ) {
	$subdomain = substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], "."));
	// define values that should NOT be affected by this test:
	$donot = array(
				'potholepatrol',
				'holisticnetworking',
				'cake',
				'www');
	if (!in_array($subdomain, $donot)) {
		define('CLIENT_NAME', $subdomain);
	} else {
		define('CLIENT_NAME', 'home');
	}
}

	/**
	 * Returns a lower case string with all spaces converted to $replacement and non word characters removed.
	 *
	 * @param string $string
	 * @param string $replacement
	 * @param int $length  max string length
	 * @return string
	 * @access public
	 */
	function slug($string, $length = 100, $replacement = '-') {
		$string = strtolower(Inflector::slug($string, $replacement));
			if (strlen($string) > $length) {
			   $string = substr($string, 0, $length);
			}
			if (substr($string, -1) == '-') {
				$string = substr($string, 0, $length-1);
			}
		return $string;
	}

//EOF
?>